<?php
include "inc/db.php";
$username=$_POST['username'];
$password=$_POST['password'];
$sql="select * from tb_user where username='$username' and password=md5('$password')";
$hasil=mysql_query($sql);
$kolom=mysql_fetch_array($hasil);

if(($kolom[0]==$username)&&($kolom[1]==md5($password))){
	session_start();
	session_register("username");
	$username=$kolom[0];
	if($kolom[2]=="master"){
		header("location:master/index.php");
	}elseif($kolom[2]=="admin"){
		header("location:admin/index.php");
	}
}else{
	header("location:index.php");
}
?>